#version 330

uniform mat4x4 u_Model;
uniform mat4x4 u_View;
uniform mat4x4 u_Persp;
uniform mat3x3 u_invTrans;

uniform float u_specularExponent;

in vec3 Position;
in vec3 Normal;
in vec3 Color;
in vec2 txCoord;

out vec3 fs_Normal;
out vec3 fs_Position;

// Fragment shader colors
#ifdef VERT_COLOR
out vec3 fs_Color;
#else
out vec2 fs_txCoord;
#endif

void main(void) {
	fs_Normal = normalize(u_invTrans*Normal);

	vec4 world = u_Model * vec4(Position, 1.0);
    vec4 camera = u_View * world;
    
    // The different color assignments
#ifdef VERT_COLOR
    fs_Color = Color;
#else
	fs_txCoord = txCoord;
#endif
    
	fs_Position = camera.xyz;
	gl_Position = u_Persp * camera;
}